import React, { Component } from 'react';
import { SearchBar, NoticeBar } from 'antd-mobile';
import { connect } from 'react-redux';

import MyAddBtn from './addBtn'
import TabBar from '../../components/tabbar/index'

class HomePage extends Component {
    constructor(props) {
        super(props);
        this.state = {
            user: '',
            pwd: '',
            showAddBtn: true
        }

    }
    render() {
        console.log(this.props.state.selectedTab);
        let route = this.props.state.selectedTab
        return (
            <div style={{ backgroundColor: '#F5F5F9' }}>
                {route === 'home' ?

                    (this.state.showAddBtn ? <MyAddBtn /> : null)

                    : null}

                <SearchBar placeholder="Search" maxLength={8} />
                <NoticeBar marqueeProps={{ loop: true }}
                    mode="closable" action={<span style={{ color: '#a1a1a1' }}>不再提示</span>}>
                    > Notice: The arrival time of incomes and transfers of Yu;E Bao will be delayed during National Day.</NoticeBar>

                <TabBar tabBarNum={5} />
            </div>
        );
    }
}
const mapStateToProps = (state) => {
    return {
        state: state.tabbar,
    }
}
const actionCreator = { }
export default connect(mapStateToProps, actionCreator)(HomePage);